package E5.Assign2;
import E5.Assign1.MyBC;

import java.io.*;
import java.net.*;
import java.util.Scanner;

public class Client {
    public static void main(String[] args) {
        Scanner inn = new Scanner(System.in);
        Socket mysocket;
        DataInputStream in = null;
        DataOutputStream out = null;
        try{
            mysocket = new Socket("172.30.1.177",2010);
            in = new DataInputStream(mysocket.getInputStream());
            out = new DataOutputStream(mysocket.getOutputStream());
            System.out.println("请输入中缀表达式：");
            String infix = inn.nextLine();
            String suffix = MyBC.infixToSuffix(infix);
            out.writeUTF(suffix);
            String result = in.readUTF();
            System.out.println("小猴收到胖砾的回答"+result);
            Thread.sleep(500);
        }catch (Exception e){
            System.out.println("胖砾又去吃饭了"+e);
        }
    }
}
